/*
 * Analyzer.h
 *
 *  Created on: 2011-03-26
 *      Author: kamil
 */

#ifndef ANALYZER_H_
#define ANALYZER_H_

#include "mgr/id/ModelId.h"
#include "mgr/video/Videodata.h"
#include "mgr/util/Vector2d.h"
#include "common.h"
#include <map>
#include <log4cxx/logger.h>

struct GameInfo{
	GameInfo();

	bool playersMoving;
	ModelId lastBallContact;
	bool ballMoved;
	bool ballOwned;
	bool ballOut;
	Vector2d outPosition;
};

/**
 * Class designed to analyze videoData passed from video client
 */
class Analyzer {
public:
	Analyzer();
	virtual ~Analyzer();

	GameInfo analyze(std::map<ModelId, Videodata> & data);

	void saveBallPosition(const Vector2d & ballPos) { savedBallPos = ballPos; }

private:
	Vector2d savedBallPos;
	GameInfo lastGameInfo;

	static const double BALL_MOVED_DISTANCE;
	static const double PLAYERS_NOT_MOVING_SPEED;

	static log4cxx::LoggerPtr logger;
};

#endif /* ANALYZER_H_ */
